package me.hl.system;


import org.junit.Test;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * Created by Planck on 2016/1/29.
 */
public class SystemDemo {
    /**
     * 该代码的作用是将数组a中，从下标为1开始，复制到数组b从下标3开始的位置，总共复制2个。
     * 也就是将a[1]复制给b[3]，将a[2]复制给b[4]，这样经过复制以后数组a中的值不发生变化，
     * 而数组b中的值将变成{0,0,0,2,3}。
     */
    @Test
    public void arrarCopy() {
        System.out.println("arrarCopy Start");
        Integer[] a = {1, 2, 3, 4};
        Integer[] b = new Integer[5];
        System.arraycopy(a, 1, b, 3, 2);
        List<Integer> list = new ArrayList<>();
        Collections.addAll(list, b);
        list.forEach(System.out::println);
        System.out.println("arrarCopy End");
    }

    @Test
    public void currentTimeMillis() {

        System.out.println(System.currentTimeMillis());
    }

    @Test
    public void exit() throws Exception {
        System.out.println("exit Start");
        Thread.sleep(1000L);
        System.exit(0);
        System.out.println("exit End");
    }


    @Test
    public void getProperty() {
        System.out.println("java.version:" + System.getProperty("java.version"));
        System.out.println("java.home:" + System.getProperty("java.home"));
        System.out.println("os.name:" + System.getProperty("os.name"));
        System.out.println("os.version:" + System.getProperty("os.version"));
    }


}
